package org.grayrabbit.commons.dao.mybatis;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.UpdateProvider;
import org.grayrabbit.commons.dao.GenericDao;
import org.grayrabbit.commons.model.CUDTemplate;

import java.io.Serializable;


public interface BaseDao<T,PK extends Serializable> extends GenericDao<T, PK>{
	/** 
     * Insert语句从CUDTemplate类中生成 
     * @param entity
     */  
	@InsertProvider(type = CUDTemplate.class,method = "insert") 
	@Options(flushCache = true,useCache = false, timeout = 20000)
	public void insert(T entity);
	
	 /** 
     * Update语句从CUDTemplate类中生成 
     * @param entity
     */  
    @UpdateProvider(type = CUDTemplate.class,method = "update")
    @Options(flushCache = true, useCache = false,timeout = 20000)
    public int update(T entity); 
    /** 
     * Delete语句从CUDTemplate类中生成 
     * @param entity
     */  
	@DeleteProvider(type = CUDTemplate.class,method = "delete")
	@Options(flushCache = true, useCache = false,timeout = 20000)
    public void delete(T entity);
	
}
